import ILogger from '@/services/logger.service';
import { Injectable, NestMiddleware } from '@nestjs/common';
import { Request, Response, NextFunction } from 'express';


@Injectable()
export class AccessMiddleware implements NestMiddleware {
  async use(req: Request, res: Response, next: NextFunction) {
    const excludeRegs: RegExp[] = [/favicon.ico/]
    if (excludeRegs.every(reg => !reg.test(req.url))) {
      ILogger.info(`Get request: ${req.url}`)
    }
    next();
  }
}